﻿using System.Configuration;
using System.Data;
using System.Windows;
using Zhaoxi.Industrial.Base;

namespace Zhaoxi.Industrial
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        /// <summary>
        /// 重写启动方法
        /// </summary>
        /// <param name="e"></param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            GobalMonitor.Start(() => {

                Application.Current.Dispatcher.Invoke(() => {
                    new MainWindow().Show();
                });
            }, (msg) => {
                App.Current.Dispatcher.Invoke(() => {
                    //错误的情况下 关机处理
                    MessageBox.Show(msg,"系统启动失败");
                    Application.Current.Shutdown();
                });
                
            });
        }

    }
}